﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Collections;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Threading;

namespace Webserver_mini
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        public TcpClient socket;
        public HttpServer srv;

        private Stream inputStream;
        public StreamWriter outputStream;

        public void handleGETRequest()
        {
            srv.handleGETRequest(this);
        }
        public abstract class HttpServer
        {
        protected int port;
        TcpListener listener;
        bool is_Active=true;
        }

        private string streamReadLine(Stream inputStream)
        {
            int next_Char;
            string data = "";
            while (true)
            {
                next_Char = inputStream.ReadByte();
                if (next_Char == -1) { Thread.Sleep(1); continue; };
                data += Convert.ToChar(next_Char);
            }
        }
        public void parseRequest()
        {
            string request = streamReadLine(inputStream);
            String[] token = request.Split(' ');
            txtInfo.AppendText("Request is: "+request);
        }
        
       
              
    }
}
